package com.mjfeed.entity;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OrderBy;
import javax.persistence.Table;

/**
 * @description 商品参数组
 * @author zhaominglei
 * @date 2014年10月1日
 */
@Entity
@Table(name = "feed_parameter_group")
public class ParameterGroup extends OrderEntity implements Serializable {
	private static final long serialVersionUID = -6697279367672990107L;
	/** 名称 */
	private String name;
	/** 商品分类 */
	private ProductCategory productCategory;
	/** 参数 */
	private List<Parameter> parameters = new ArrayList<Parameter>();

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name="product_category_id")
	public ProductCategory getProductCategory() {
		return productCategory;
	}

	public void setProductCategory(ProductCategory productCategory) {
		this.productCategory = productCategory;
	}

	@OneToMany(mappedBy="parameterGroup", fetch=FetchType.LAZY)
	@OrderBy("orders asc")
	public List<Parameter> getParameters() {
		return parameters;
	}

	public void setParameters(List<Parameter> parameters) {
		this.parameters = parameters;
	}
}
